@extends('admin.common.option')
@section('content')
<section class="Hui-article-box" style="left: 0;">
	<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 文章管理 <span class="c-gray en">&gt;</span> 文章列表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
		
	<div class="Hui-article" >
		<article class="cl pd-20">

			<div class="cl pd-5 bg-1 bk-gray mt-20"> 
				<span class="r">共有数据：<strong>{{$count}}</strong> 条</span> </div>
			<div class="mt-10">
				<table class="table table-border table-bordered table-bg table-sort">
					<thead>
						<tr class="text-c">
							<th width="70">ID</th>
							<th width="80">昵称</th>
							<th width="200">email</th>
							<th width="300">内容</th>
							<th>创建时间</th>
							<th>修改时间</th>
							<th width="100">操作</th>
						</tr>
					</thead>
					<tbody>
						@foreach($repliesList as $k => $v)
						<tr class="text-c">
							<td>{{$v['id']}}</td>
							<td>{{$v['nickname']}}</td>
							<td>{{$v['email']}}</td>
							<td>{{$v['content']}}</td>
							<td>{{$v->created_at}}</td>
							<td>{{$v->updated_at}}</td>
							<td class="f-14 product-brand-manage">
							
								<a style="text-decoration:none" onClick="addHtml('编辑文章','{{url('admin/replies',[$v['id'],'edit'])}}','1400','600')" href="javascript:;" title="编辑">
									<i class="Hui-iconfont">&#xe6df;</i>
								</a> 
								<a style="text-decoration:none" class="ml-5" onClick="delData('{{url('admin/replies',[$v['id']])}}')" href="javascript:;" title="删除">
									<i class="Hui-iconfont">&#xe6e2;</i>
								</a>

							</td>
						</tr>
						@endforeach
					</tbody>
				</table>
				{{$repliesList->render() }}
			</div>
		</article>
	</div>
</section>
<script type="text/javascript">
	function addHtml(title,url,w,h){
		layer_show(title,url,w,h);
	}

	function delData(url){
		layer.confirm('是否要删除？', {
		  	btn: ['是','否'] //按钮
		}, function(){
			$.ajaxSetup({
		        headers: {
		            'X-CSRF-TOKEN': '{{csrf_token()}}',
		        }
		    });
			$.ajax({
			    url: url,
			    type: 'DELETE',
			    success: function(res) {
					if(res.status=='success'){
						layer.msg(res.msg, {icon: 1},function(){
							location.reload();
						});
					}else{
						layer.msg(res.msg, {icon: 2});
					}
			    }
			});
		}, function(){
		  
		});
	}

</script>

@endsection